home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Personal Computer World 2009 February
/
PCWFEB09.iso
/
Software
/
Resources
/
Burning & Media
/
GB-PVR 1.2.13
/
GBPVR10213.msi
/
Cabs.w1.cab
/
ManualRecord.aspx.cs429
< prev
next >
Wrap
Text File
|
2007-12-14
|
8KB
|
206 lines
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using GBPVRSchedule;
using gbweb.classes;
using GBPVR.Public;
namespace gbweb
{
public partial class Migrated_ManualRecord : ManualRecord
{
private Settings guideParams;
protected void Page_Load(object sender, EventArgs e)
{
getTheme();
if (!IsPostBack)
{
//Load the settings from the config file
guideParams = Global.Settings;
//Fill the drop down list of channels
Global.FillChannelList(listChannels);
//Set the default name for the recording...display class will provide "Manual Recording"
//if this field remains null
pgmName.Text = null;
//Set the default recording Quality
quality.SelectedValue = guideParams.recordingQuality;
//Default the start date to today
startDate.SelectedDate = DateTime.Now;
//Default the start time to now
startTime.SelectedTime = DateTime.Now;
//Default the stop time to 1 hour from the start time
endTime.SelectedTime = DateTime.Now.AddHours(1);
//Ensure the error message box is not displaying
RecordMessage.Visible = false;
}
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
bool scheduleReturn = true;
//Create a Programme
Programme dummyPgm = new Programme();
//Set the channel that is to be recorded
dummyPgm.setChannelOID(System.Convert.ToInt32(listChannels.SelectedValue));
//Set the start time for for programme to record
string sDate = startDate.SelectedDate.ToShortDateString();
string sTime = startTime.SelectedTime.ToShortTimeString();
DateTime fullStartDate = Convert.ToDateTime(sDate + " " + sTime);
dummyPgm.setStartTime(fullStartDate);
//Set the end time for the programme to record
string eDate = startDate.SelectedDate.ToShortDateString();
string eTime = endTime.SelectedTime.ToShortTimeString();
DateTime fullEndDate = Convert.ToDateTime(eDate + " " + eTime);
//Update the end date if the recording spans two different dates
if (fullEndDate.Hour < fullStartDate.Hour)
{
fullEndDate = fullEndDate.AddDays(1);
}
dummyPgm.setEndTime(fullEndDate);
if (pgmName.Text.Length > 0)
{
dummyPgm.setTitle(pgmName.Text);
}
//Create the recording
//scheduleReturn = myschedule.ManualSchedule(dummyPgm, recQuality);
Schedule.Quality quality = 0;
int prePad = Convert.ToInt32(prePadding.Text);
int postPad = Convert.ToInt32(postPadding.Text);
switch (Request.Params["quality"].ToLower())
{
case "high":
quality = Schedule.Quality.High;
break;
case "medium":
quality = Schedule.Quality.Medium;
break;
case "low":
quality = Schedule.Quality.Low;
break;
case "custom1":
quality = Schedule.Quality.Custom1;
break;
case "custom2":
quality = Schedule.Quality.Custom2;
break;
}
if (radioDay.SelectedValue == "once")
{
// schedule one-off recording
Schedule myschedule = Global.Schedule;
scheduleReturn = myschedule.ScheduleOnce(dummyPgm, quality, prePad, postPad);
}
else
{
//Schedule Season Recordings
//Set the max number of recordings to keep for the show
int keepnumRecordings = ReoccuringRecordingExtras.KEEP_ALL_FILES;
if (keepRecordings.Text.ToString() != null)
{
try
{
keepnumRecordings = System.Convert.ToInt32(keepRecordings.Text);
}
catch
{
keepnumRecordings = ReoccuringRecordingExtras.KEEP_ALL_FILES;
}
}
else
{
keepnumRecordings = ReoccuringRecordingExtras.KEEP_ALL_FILES;
}
Schedule myschedule = Global.Schedule;
// schedule manual recording for every day of the week
if (radioDay.SelectedValue == "everyDay")
{
scheduleReturn = myschedule.ScheduleThisTime(dummyPgm, quality, Schedule.DayType.SheduleAnyDay, keepnumRecordings, Schedule.RecType.Daily, prePad, postPad);
}
// schedule manual recording for this day on each week
else if (radioDay.SelectedValue == "everyWeek")
{
scheduleReturn = myschedule.ScheduleThisTime(dummyPgm, quality, Schedule.DayType.SheduleThisDay, keepnumRecordings, Schedule.RecType.Weekly, prePad, postPad);
}
// schedule manual recording for weekdays
else if (radioDay.SelectedValue == "weekDays")
{
scheduleReturn = myschedule.ScheduleThisTime(dummyPgm, quality, Schedule.DayType.SheduleThisDay, keepnumRecordings, Schedule.RecType.WeekDays, prePad, postPad);
}
// schedule manual recording for weekends
else if (radioDay.SelectedValue == "weekEnd")
{
scheduleReturn = myschedule.ScheduleThisTime(dummyPgm, quality, Schedule.DayType.SheduleThisDay, keepnumRecordings, Schedule.RecType.WeekEnds, prePad, postPad);
}
}
//Display error message if recording does not schedule
if (scheduleReturn)
{
// close popup details window
Page.RegisterStartupScript("startupScript", "<script language=JavaScript>reloadAndClose();</script>");
}
else
{
RecordMessage.Text = "Recording Failed!";
RecordMessage.Visible = true;
}
}
private void getTheme()
{
string theme = System.Convert.ToString(Session["theme"]);
if (theme != null && theme != "")
{
return;
}
else
{
HttpCookie cookie = Request.Cookies["theme"];
if (cookie != null && cookie.Value.Length > 0)
{
theme = cookie.Value;
}
else
{
theme = "Default";
}
Session["theme"] = "themes/" + theme;
return;
}
}
}
}